//
//  BaseDefinition.h
//
//
//  Created by FengDongsheng on 13-10-21.
//  Copyright (c) 2013年 All rights reserved.
//

#ifndef BaseDefinition_h
#define BaseDefinition_h

//cell注册ID
#define CellID_DiscoverTableViewCell       @"DiscoverTableViewCell"
#define CellID_PublicRightImageCell        @"PublicRightImageCell"
#define CellID_PublicThreeImageCell        @"PublicThreeImageCell"

#ifdef DEBUG
# define NSLog(formater, ...) NSLog((@"\n文件名-> %s\n" "函数名-> %s\n" "行号  -> %d\n" formater @"\n-------------------------------------------------------------------\n"), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define NSLog(...);
#endif

#define TeamID                      @"W7UK99CA3L"
#define GaoDeMapKey                 @"245c8baf20cfd34bd7e7634e58ee9fee"
#define UMengKey                    @"5d64a2dd0cafb2dc95000402"
#define DandelionKey                @"f072cf4049735f03883049fd037d205b"

#define WXAppID                     @"wxe77aafa757100bb0"
#define WXAppSecret                 @"3c94764bc8ecbf62ef49a1ecd5bd8f8b"
//wx50f29f1dd41683ec
#define QQAPPID                     @"1109888856"
#define QQAPPKEY                    @"5EoyZiesmxHG4Dzj"
#define BUGLYID                     @"429bc1c486"
#define BUGLYAppKey                 @"4cffbead-18e2-413a-bb0d-98e331f32583"

#define AppID                       @"1140003199"
#define SKU                         @"Kdc.SW"

//#define UMSocialPlatformType_Collect                    @"1000"
//31.236367,121.480165 纬度经度

//-------------------Weak & Strong----------------------

#pragma mark - 解决循环应用相关
#define Weak(var, weakVar) __weak __typeof(&*var) weakVar = var
#define Strong_DoNotCheckNil(weakVar, _var) __typeof(&*weakVar) _var = weakVar
#define Strong(weakVar, _var)       Strong_DoNotCheckNil(weakVar, _var); if (!_var) return;

#define Weak_(var)                  Weak(var, weak_##var);
#define Strong_(var)                Strong(weak_##var, _##var);
#define WeakSelf                    Weak(self, weakSelf);
#define StrongSelf                  Strong(weakSelf, strongSelf);

//-------------------获取设备大小-------------------------

//获取屏幕 宽度、高度
#define SCREEN_WIDTH                                  ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT                                 ([UIScreen mainScreen].bounds.size.height)
#define ViewWidth(v)                                  v.frame.size.width
#define ViewHeight(v)                                 v.frame.size.height
#define ViewX(v)                                      v.frame.origin.x
#define ViewY(v)                                      v.frame.origin.y
#define WIDTHRADIUS                                   SCREEN_WIDTH/375.0
#define VideoScale                                    1080.f/2058.f


#define kIs_iphone                  (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define kIs_iPhoneX                 SCREEN_WIDTH >=375.0f && SCREEN_WIDTH < 414.0f && SCREEN_HEIGHT >=812.0f && SCREEN_HEIGHT < 896.0f && kIs_iphone
#define kIs_iPhoneXSMax             SCREEN_WIDTH >=414.0f && SCREEN_HEIGHT >=896.0f&& kIs_iphone
/*状态栏高度*/
#define kStatusBarHeight            (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax?(44.0):(20.0))
/*导航栏高度*/
#define kNavBarHeight (44)
/*状态栏和导航栏总高度*/
#define kNavBarAndStatusBarHeight   (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax ? (88.0) : (64.0))
/*TabBar高度*/
#define kTabBarHeight               (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax?(49.0 + 34.0):(49.0))
/*顶部安全区域远离高度*/
#define kTopBarSafeHeight           (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax?(44.0):(0))
/*底部安全区域远离高度*/
#define kBottomSafeHeight           (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax?(34.0):(0))
/*iPhoneX的状态栏高度差值*/
#define kTopBarDifHeight            (CGFloat)(kIs_iPhoneX || kIs_iPhoneXSMax?(24.0):(0))

/// 获取View的属性
#define GetViewWidth(view)          view.frame.size.width
#define GetViewHeight(view)         view.frame.size.height
#define GetViewX(view)              view.frame.origin.x
#define GetViewY(view)              view.frame.origin.y

#define GetViewXW(view)             view.frame.origin.x + view.frame.size.width
#define GetViewYH(view)             view.frame.origin.y + view.frame.size.height


#define ADAPT_W(v)                  (SCREEN_WIDTH*(v)/375.0f)

#define ADAPT_H(v)                  ((kIs_iPhoneX ? (kIs_iPhoneXSMax?736.0f:667.0f) : SCREEN_HEIGHT)*(v)/667.0f)
#define LHYSpace                    ADAPT_W(16.0f)
//----------------------系统----------------------------
//获取系统版本
#define IOS_VERSION                                   [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion                          [[UIDevice currentDevice] systemVersion]

//获取当前语言
#define CurrentLanguage                               ([[NSLocale preferredLanguages] objectAtIndex:0])

//当前应用的版本号
#define CurrentAppVersion                             [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
#define SAVE_APP_VERSION                              @"app_local_version"

//获取应用名称
#define APP_NAME                                      [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]

//自定义高效率的 NSLog
#ifdef DEBUG
#define Log(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define Log(...)
#endif

//设置 view 圆角和边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

//获取沙盒 Document
#define kPathDocument [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]

//判断是真机还是模拟器
#if TARGET_OS_IPHONE
//iPhone Device
#endif

#if TARGET_IPHONE_SIMULATOR
//iPhone Simulator
#endif

//检查系统版本
#define SYSTEM_VERSION_EQUAL_TO(v)                   ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)               ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)   ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)      ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)


//----------------------系统----------------------------


//主要单例
#define UserDefaults                                [NSUserDefaults standardUserDefaults]
//沙盒存储
#define UserDefaultsPlayInAllNet                    @"PlayInAllNet"
#define IsNotFirstOpen                              @"isNotFirstOpen"       //不是第一次打开


#define NotificationCenter                          [NSNotificationCenter defaultCenter]
#define SharedApplication                           [UIApplication sharedApplication]
#define Bundle                                      [NSBundle mainBundle]
#define MainScreen                                  [UIScreen mainScreen]

//>>>>>>>>>>>>>>>>>>>>>字符串判定
#define IsNilString(__String)       (__String == nil || [__String isEqualToString:@""] || [__String isEqualToString:@"null"] || [__String isEqualToString:@"<null>"] || [__String isEqualToString:@"(null)"])

#define IsNotNilArr(arr)               (arr != nil && ![arr isKindOfClass:[NSNull class]] && arr.count != 0)
//----------------------图片----------------------------
//定义UIImage对象
#define ImageNamed(fileName)        [UIImage imageNamed:fileName]
#define LHYPlaceholderImage         ImageNamed(@"placeholder")
//----------------------颜色类---------------------------
// rgb颜色转换（16进制->10进制）
#define UIColorFromRGB(rgbValue)    [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBCOLOR(r,g,b)             [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBACOLOR(r,g,b,a)          [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]


#define LHYPlaceholderColor         UIColorFromRGB(0xEFF1FF)

//----------------------其他----------------------------

#define IOSVERSION                  ([[[UIDevice currentDevice] systemVersion] doubleValue])
#define IOS10_0                     (IOSVERSION >= 10.0)

//普通
#define FONT(F)                     [UIFont systemFontOfSize:F]
//黑体
#define FONT_BOLD(F)                [UIFont boldSystemFontOfSize:F]

//设置View的tag属性
#define VIEWWITHTAG(_OBJECT, _TAG)  [_OBJECT viewWithTag : _TAG]
//程序的本地化,引用国际化的文件
#define MyLocal(x, ...)             NSLocalizedString(x, nil)

//G－C－D
#define BACK(block)                 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define MAIN(block)                 dispatch_async(dispatch_get_main_queue(),block)


//由角度获取弧度 有弧度获取角度
#define degreesToRadian(x)          (M_PI * (x) / 180.0)
#define radianToDegrees(radian)     (radian*180.0)/(M_PI)

//获取字典的key对应的String value
#define DSStringValue(x) x == nil ? @"" : x














#endif
